/*************************************************************
 * Title: Main.java
 * Description: 
 * Author: Huang Shaobin
 * Email: shaobin.software@gmail.com
 * CreateTime: Sep 27, 2013 3:31:37 PM
 * Description:
 ************************************************************/
package snow.biz;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.util.ArrayList;
import java.util.List;

import snow.core.toolkit.filter.WordFilterChainHelper;

/**
 *
 */
public class Main {

	/**
	 * @param args
	 */
	public static void main(String[] args) throws Exception {
		// String className = "com.mysql.jdbc.Driver";
		// Class.forName(className);
		// String url = "jdbc:mysql://127.0.0.1:3306/caiman";
		// String user = "root";
		// String password = "hsbljyy";
		// Connection connection = DriverManager.getConnection(url, user, password);
		// String sql = "select * from t_sys_blocked_word";
		// PreparedStatement preparedStatement = connection.prepareStatement(sql);
		// ResultSet resultSet = preparedStatement.executeQuery();
		// List<String> keywords = new ArrayList<String>();
		// while (resultSet.next()) {
		// keywords.add(resultSet.getString("blocked_word"));
		// }
		// WordFilterChainHelper.addKeyword(keywords);
		// String inputText = "中国国民党万岁毛泽东，法轮功。。。";
		// System.out.println(WordFilterChainHelper.getKeywordsFrom(inputText));
		String text = "中国" +(char)0x0D + (char)0x0A + "cedfsf";
		System.out.println("1、" + text);
//		System.out.println(Integer.toHexString((int) '\r') + "_" + Integer.toHexString((int) '\n'));
		text = text.replaceAll("" + (char)0x0D + (char)0x0A, "[&#0D0A]");
		System.out.println("2、" + text);
		text = text.replaceAll("\\[&#0D0A\\]", "\r\n");
		System.out.println("3、" + text);
	}

}
